﻿using System.Linq;
using Turquoise.Business.Abstract;
using Turquoise.DataAccess.Abstract;
using Turquoise.Entities.Data;

namespace Turquoise.Business
{
    public class SettingManager : ISettingService
    {
        private readonly IRepository<Setting> _settingRepository;

        public SettingManager(IRepository<Setting> settingRepository)
        {
            _settingRepository = settingRepository;
        }

        public string GetValueByKey(string key)
        {
            return _settingRepository.DbSet().Where(e => e.SettingKey == key).Select(t => t.SettingValue).FirstOrDefault();
        }
    }
}
